package com.usian.controller;

import com.usian.pojo.TbUser;
import com.usian.service.SSOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class SSOController {
    @Autowired
    private SSOService ssoService;
    @RequestMapping("/service/checkUserInfo/{checkValue}/{checkFlag}")
    public boolean checkUserInfo(@PathVariable String checkValue,
                                 @PathVariable Integer checkFlag){
        return ssoService.checkUserInfo(checkValue,checkFlag);
    };
    @RequestMapping("userRegister")
    public int userRegister(@RequestBody TbUser tbUser){
        return ssoService.userRegister(tbUser);
    };
    @RequestMapping("userLogin")
    public Map userLogin(@RequestParam String username, @RequestParam String password){
        return ssoService.userLogin(username,password);
    };

    @RequestMapping("logOut")
    public Boolean logOut(@RequestParam String token){
        return ssoService.logOut(token);
    };

    @RequestMapping("getUserByToken/{token}")
    public TbUser getUserByToken(@PathVariable String token){
        return ssoService.getUserBYToken(token);
    };



}
